<?php
class User_Model extends CI_Model
{
    public $name;
    public $password;


    function __construct()
    {
        $this->setTableName("users");
        parent::__construct();
    }

    function verify($_POST)
    {
        $q = $this->db
            ->where('nickname', $_POST['nickname'])
            ->where('password', md5($_POST['password']))
            ->limit(1)->get($this->getTableName());

        if ($q->num_rows > 0) {
            $this->load->library('session');
            $this->session->set_userdata("user", array("nickname" => $_POST['nickname']));
            return $q->row();
        }
        return false;
    }

}